//
//  CacheData.m
//  YueMi
//
//  Created by Rainbow on 4/27/11.
//  Copyright 2011 iTotemStudio. All rights reserved.
//

#import "CacheData.h"

@implementation CacheData
@synthesize advertisings, user, latitude, longitude;

static CacheData *_sharedInst;

+(CacheData *)sharedData
{
	@synchronized(self)
	{
		if (_sharedInst == nil) {
			_sharedInst = [[CacheData alloc] init];
		}
	}
	return _sharedInst;
}	

-(id)init
{
    self = [super init];
    if (self) {
        advertisings = [[NSMutableDictionary alloc] initWithCapacity:0];
        user = [[User alloc] init];
    }
    return self;
}

- (NSUInteger)retainCount{
	return NSUIntegerMax;
}

- (oneway void)release{
}

- (id)retain{
	return _sharedInst;
}

- (id)autorelease{
	return _sharedInst;
}

- (void) restore{
    [advertisings removeAllObjects];
}

-(void)dealloc
{
    self.user = nil;
    self.advertisings = nil;
    self.latitude = nil;
    self.longitude = nil;
    [super dealloc];
}

@end
